//
//  MMNavigationController.m
//  zhihuDaily
//
//  Created by  陈聪 on 16/6/11.
//  Copyright © 2016年 cc. All rights reserved.
//

#import "MMNavigationController.h"

@interface MMNavigationController ()<UIGestureRecognizerDelegate>

@end

@implementation MMNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.interactivePopGestureRecognizer.enabled = NO;
    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self.interactivePopGestureRecognizer.delegate action:@selector(handleNavigationTransition:)];
    pan.delegate = self;
    [self.view addGestureRecognizer:pan];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
//    if (self.childViewControllers.count == 0) {
//        if ([viewController isKindOfClass:NSClassFromString(@"MMHomeController")]) {
//            viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self Action:@selector(clickLeftBarButton) image:@"Home_Icon" hightimage:@"Home_Icon_Highlight"];
//        }else{
//            viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self Action:@selector(clickLeftBarButton) image:@"Dark_News_Arrow" hightimage:@"Dark_News_Arrow_Highlight"];
//        }
//        
//        
//        
//    }
//    [super pushViewController:viewController animated:animated];
//}

// 是否开始触发手势
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
    // 判断当前控制器是否是根控制器，是的话不要触发手势
    return (self.topViewController != [self.viewControllers firstObject]);
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
//- (void)clickLeftBarButton{
//    [kNotificationCenter postNotificationName:OpenDrawer object:nil];
//}
@end
